//
//  BaseVC.m
//  BaseCode
//
//  Created by 曹连华 on 2020/3/19.
//

#import "BaseVC.h"

@interface BaseVC ()

@end

@implementation BaseVC
- (instancetype)init {
    self = [super init];
    if (self) {
        self.navigationBarHidden = NO;
        self.hidesBottomBarWhenPushed = self.topVcTabbarHideStatus;
    }
    return self;
}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self stashNavigationBarAttribute];
    [self.navigationController setNavigationBarHidden:self.navigationBarHidden animated:animated];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [self restoreNavigationBarAttribute];
    [self.navigationController setNavigationBarHidden:self.navigationBarHiddenPop animated:animated];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.edgesForExtendedLayout = UIRectEdgeNone;
    [self setNaviButtonWithImageName:@"navigation_btn_back" position:BarButtonItemPositionLeft];
}

- (BOOL)shouldAutorotate {
    return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown: UIInterfaceOrientationMaskPortrait;
}
- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

@end
